﻿using BoldBrick.Core.Logging;
using Microsoft.SharePoint;

namespace BoldBrick.SharePoint.CommonControls.Logging
{
    /// <summary>
    /// This class provides logging in elevated priviliges context
    /// </summary>
	public class PrivilegedContextLoggerInit : ILoggerInitContext
    {
        #region ILoggerInitContext Members
		/// <summary>
		/// Itializes logger in elevated priviliges context
		/// </summary>
		/// <param name="init">Logger to initalize</param>
        public void InitLoggerInContext(ILoggerInit init)
        {
            SPSecurity.RunWithElevatedPrivileges(
                delegate
                {
                    init.Init();
                });
        }

        #endregion
    }
}
